<template>
  <el-dialog title="绑定业务员" width="30%" :visible.sync="show" @close="dialogClose">
    <el-form ref="form" :model="form" label-width="120px" style="margin-right:80px">
      <el-form-item label="绑定业务员" prop="salesmanId" :rules="rules.def">
        <form-remote-select
          v-model="form.salesmanId"
          :url="$http.conf.api.get('wms').url+'/api/service/index/findPurList'"
        />
      </el-form-item>
      <!-- <el-form-item label="备注" prop="remark">
        <el-input v-model="form.remark" type="textarea" class="col" placeholder="备注" />
      </el-form-item> -->
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button v-loading="modal_loading" type="primary" @click="submit">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
// import adminSupport from 'lola-admin-support-el'
export default {
  // mixins: [adminSupport.mixins.edit],
  data() {
    return {
      show: false,
      form: {},
      modal_loading: false,
      rules: this.$ruleStore.rules
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {

    },
    bind(row) {
      this.show = true
      this.form = row
    },
    submit() {
      const that = this
      this.modal_loading = true
      const url = that.$http.conf.api.get('wms').url + '/api/ser/supplier-info//bindService'
      const data = {
        id: that.form.id,
        salesmanId: that.form.salesmanId
      }
      that.$http.post(url, data).then(function(rsp) {
        that.modal_loading = false
        if (rsp.code !== 200) {
          that.$message.error(rsp.message)
          return
        }
        that.$message.success('操作成功!')
        that.show = false
        that.$emit('bindQuery', data)
      }).catch(function(err) {
        that.modal_loading = false
        console.log(err)
      })
    },
    // 监听弹出层关闭
    dialogClose() {
      this.form.serviceId = ''
    }
  }
}
</script>
